package com.zhenwei.zscm.controller;

import com.zhenwei.zscm.common.annotations.MethodName;
import com.zhenwei.zscm.common.base.RestResult;
import com.zhenwei.zscm.model.vo.order.QueryOrderStatisticVO;
import com.zhenwei.zscm.service.OrderService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/order/statistic")
@MethodName("售后工单统计")
@AllArgsConstructor
public class OrderStatisticController {
    private OrderService orderService;

    @PostMapping("/byDate")
    @MethodName("按日期统计工单数量")
    public RestResult findByDate(@RequestBody QueryOrderStatisticVO vo) {
        return orderService.dateOrderStatistic(vo);
    }

    @GetMapping("/byState")
    @MethodName("统计工单状态数量")
    public RestResult countByState(){
        return orderService.countByState();
    }

    @GetMapping("/byProductRepairState")
    @MethodName("统计产品维修状态数量")
    public RestResult countByProductRepairState(){
        return orderService.countByProductRepairState();
    }
}
